package query;

import java.io.IOException;
import java.io.Serializable;
import java.util.Date;
import java.util.Vector;

import model.Anhaenger;
import server.MySqlConnector;

public class AnhaengerSuchenQuery extends AbstractQuery implements Serializable {

	public void setVonZeitraum(Date vonZeitraum) {
		this.vonZeitraum = vonZeitraum;
	}

	public void setBisZeitraum(Date bisZeitraum) {
		this.bisZeitraum = bisZeitraum;
	}

	public void setTage(int tage) {
		this.tage = tage;
	}

	public void setAnhaengertyp(int anhaengertyp) {
		this.anhaengertyp = anhaengertyp;
	}

	public Date getVonZeitraum() {
		return vonZeitraum;
	}

	public Date getBisZeitraum() {
		return bisZeitraum;
	}

	public int getTage() {
		return tage;
	}
	
	public int getAnhaengertyp() {
		return anhaengertyp;
	}

	private int anhaengertyp;
	private Date vonZeitraum;
	private Date bisZeitraum;
	private int tage;

	/*
	 * (non-Javadoc)
	 * 
	 * @see controller.AbstractQuery#doAction()
	 */

	private static final long serialVersionUID = 2661011647794721161L;
	private Vector<Anhaenger> anhaenger;

	@Override
	public void doAction() {
		anhaenger = MySqlConnector.getAnhaenger(vonZeitraum,bisZeitraum,anhaengertyp);

		try {
			serverOutputStream.writeObject(anhaenger);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		// TODO Auto-generated method stub
	}
}
